1. Field of the Invention
The present invention relates to computer programming and, more particularly, to more efficiently processing computer programs written in programming languages requiring virtual machines for execution.
2. Description of the Related Art
An interpreted programming language, unlike a compiled language, is converted to machine specific code at runtime through the use of an interpreter program. The interpreter program, also referred to as a virtual machine, interfaces the application written in the interpreted programming language with the target computing platform upon which the application is to be executed. The virtual machine is a software engine that runs on top of the hardware and operating system of the target computing platform. The advantage of using an interpreted programming language is that once an application is written, the application generally can be run on different computing platforms given the existence of a suitable virtual machine for the chosen platform.
JAVA is one example of such a programming language. JAVA source code is compiled to run on a JAVA virtual machine (JVM). Any platform for which a JVM has been implemented can execute JAVA applications. Platform independence is achieved by compiling JAVA source code into a set of one byte digits called “byte code”. A byte code may be viewed as a machine code for the JVM, wherein each byte code corresponds to a JVM instruction as defined in the specifications for the JVM. The byte code is platform independent. The JVM acts as an interpreter between the Java byte code and the specific computing platform on which the JAVA program is to execute.
Programs written in interpreted programming languages generally run more slowly than similar programs written in compiled programming languages such as C or C++. In the case of JAVA, for example, the JVM steps through the compiled JAVA program, typically referred to as a JAVA class file, byte code-by-byte code, translating each into native instruction sequences on the fly. This process is slower as compared to executing applications that are compiled and then loaded as a set of native machine instructions.
In order to improve runtime performance of interpreted languages, virtual machines have come to incorporate “Just In Time” (JIT) compilers. A JIT compiler translates certain byte code segments into machine code for the particular hardware platform upon which the virtual machine is implemented. This translation occurs at one time and the block of compiled code is then stored, typically in a non-persistent data store, for later execution. This speeds up execution of the program by avoiding any interpretation phase for frequently executed application components.
One difficulty with JIT compilation is that some run-time execution analysis is required to determine which program components execute frequently and, thus, should be translated into machine specific code. Current solutions utilize virtual machines that are configured to count the number of times a particular component executes and JIT compile components that are executed more times that a threshold number of times. Typically, this threshold, called a JIT threshold, is large, on the order of several thousand.
The threshold is set high enough so that only those methods executed most often are JIT compiled. Such is the case as JIT compiling itself can increase execution time of an application if not used judiciously. In particular, JIT compiling components can require significant computing resources and time. The resulting machine specific code for the component must be executed enough times subsequent to the JIT compilation to overcome the amount of time spent JIT compiling the component(s). Large thresholds help to ensure that this is the case.
While large JIT compilation thresholds may be suitable for long lived applications, such as a server-based applications, short lived applications often see little or no benefit. Short lived applications such as client applications typically are started and terminated over a period of hours and/or days. During such short time periods, it is unlikely that any components will be executed enough to exceed a JIT compilation threshold. Accordingly, it is unlikely that any methods will be JIT compiled.
It would be advantageous to JIT compile selected components of an application written in an interpreted programming language such that execution time is optimized.